﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Basis.Domain;
using Tanmia.Warehouse.Core;
using Tanmia.Basis.Data;

namespace Tanmia.Warehouse.Domain
{
    public class UnitDomain : BaseDomain<Unit>
    {
        public UnitDomain(ISessionManager sessionManager)
            : base(sessionManager)
        {
        }

        public IList<Unit> GetsWithBase()
        {
            IList<Unit> units = Gets();
            units.Insert(0, Unit.BaseUnit);
            return units;
        }

        public IList<Unit> GetsExcept(Unit exceptedUnit)
        {
            return exceptedUnit == null || exceptedUnit.Equals(Unit.BaseUnit) ?
                Gets() :
                Gets(x => x.UnitID != exceptedUnit.UnitID);
        }
    }
}
